<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<html:xhtml />
<script type="text/javascript">
    $(document).ready(function() {
        // 'DataTablize' the table
        $("#approvalTable").dataTable({
            "bPaginate": true,
            "sPaginationType": "full_numbers",
            "bFilter": true,
            "bJQueryUI": true,
            "bAutoWidth": false,
            "aoColumns": [null, {"sType": "date"}, null, null, null, null, null]
        });

        $("[name=status] option:first").attr("selected", "selected");
    });
</script>
<div id="dataRequestApproval" class="content list">
    <h2>Data Request Approvals</h2>
    <html:form action="dataRequestApprovals">
        <table id="approvalTable" cellpadding="0" cellspacing="0" border="0" class="display">
            <thead>
                <tr>
                    <th>From</th>
                    <th>Date</th>
                    <th>Cohorts</th>
                    <th>SNPs</th>
                    <th>Variables</th>
                    <th>Status</th>
                    <th>Comments</th>
                </tr>
            </thead>
            <tbody>
                <nested:iterate name="dataRequestApprovalForm" property="dataReqAppList">
                    <tr>
                        <td><nested:write property="from"/></td>
                        <td><nested:write property="dataRequest.requestDate" format="dd MMM yyyy" /></td>
                        <td><nested:write property="dataRequest.cohorts"/></td>
                        <td><nested:write property="dataRequest.snps"/></td>
                        <td><nested:write property="dataRequest.variables"/></td>
                        <td>
                            <nested:select property="status">
                                <html:option value="Pending">Pending</html:option>
                                <html:option value="Approved">Approved</html:option>
                                <html:option value="Denied">Denied</html:option>
                            </nested:select>
                        </td>
                        <td><nested:text property="comments" /></td>
                    </tr>
                </nested:iterate>
            </tbody>
        </table>
        <p><html:submit property="submitType" value="Save"/></p>
    </html:form>
</div>